package net.zjitc.controller;

import net.zjitc.pojo.User;
import net.zjitc.pojo.UserVo;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.Map;

@Controller
public class JsonController {
   //用户名和密码  json--->json

    @ResponseBody
    @RequestMapping(value = "/testa")
    public Map testa(@RequestBody UserVo userVo){
         /* User u =  new User();
          u.setPassword(userVo.getPassword());
          u.setUsername(userVo.getUsername());*/
         Map map = new HashMap();
         String username = userVo.getUsername();
         if (username.equals("张三")){
             map.put("result","error");
             //map.put("user",userVo);
         }else {
             map.put("result","success");
            // map.put("user",userVo);
         }
          return map;
    }
    //测试的，如果用手机号码注册呢？？手机号码是不可以重复的
}
